package 
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	/**
	 * 字体注册 
	 * @author HQing
	 * 
	 */	
	public class FontTest extends Sprite
	{
		private var loader:Loader;
		public function FontTest()
		{
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
			loader.load(new URLRequest("fonts.swf"));
		}
		
		/**
		 * 回调函数 
		 * @param event
		 *  event:事件
		 */		
		private function completeHandler(event : Event):void 
		{
			loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
			var fmt:TextFormat=new TextFormat("Yahei", 68, 0x336699); //使用MyFont字体
			var txt : TextField = new TextField();
			txt.autoSize=TextFieldAutoSize.LEFT;
			txt.embedFonts=true;
			txt.text="布拉名mao毛mao字七个字";
			txt.setTextFormat(fmt);
			addChild(txt);
		}
	}
}